<?php
/**
 * Created by PhpStorm.
 * User: fly
 * Date: 2018\1\13 0003
 * Time: 18:21
 */
use common\models\UserModel;
use yii\widgets\LinkPager;
use common\models\Country;
$this->title = "查询检索-全部-资产包-项目";
$this->registerCssFile('@web/css/index.css');
$this->registerCssFile('@web/css/paging.css');
$this->registerCssFile('@web/css/OfficeHall.css');
$this->registerJsFile('@web/js/index.js',['depends'=>['backend\assets\AppAsset'],'position'=>$this::POS_HEAD]);
$this->registerJsFile('@web/js/paging.js',['depends'=>['backend\assets\AppAsset'],'position'=>$this::POS_HEAD]);
$this->registerJsFile('@web/js/OfficeHall.js',['depends'=>['backend\assets\AppAsset'],'position'=>$this::POS_HEAD]);
?>
<style>
    em {
        color: red;
    }
    .pagingBoxNew {
    	position: relative;
    	margin-top: 20px;
    }
     .pagingBoxNew .totalSize {
    	float: right;
    }
  
     .pagingBoxNew .pageBox{
    	position: absolute;
    	left: 50%;
    	transform: translateX(-50%);
    }
    .pagingBoxNew a{
        display: block;
        float: right;
        height: 30px;
        line-height: 30px;
        padding: 0 12px;
        text-align: center;
        /*margin-left: 4px;*/
        border: 1px solid #dcdcdc;
        color: #337ab7;
        font-size: 12px;
        cursor: pointer;
        font-weight: 400;
    }
    .pagingBoxNew a:link{
    	text-decoration: none;
    }
    .pagingBoxNew .pageBox a:last-child {
	    border-top-left-radius: 4px;
	    border-bottom-left-radius: 4px;
	    color: #777777;
    }
    .pagingBoxNew .pageBox a {
    	border-right: none;
    }
     .pagingBoxNew .pageBox a:first-child {
     	border-top-right-radius: 4px;
     	border-bottom-right-radius: 4px;
     	border: 1px solid #dcdcdc;
     	color: #777777;
     }
    .cur{
        background-color: #337ab7;
        color: #fff!important;
        background-color: #337ab7;
   		 border-color: #337ab7;
    }
    .searchalls{position: relative;}
    .OfficeHallContentAll .searchall .searchalls .data-ul{width: 769px;  border: 1px solid rgb(33, 148, 221); border-top: none; position: absolute; top: 40px; left: 0; z-index: 999999; background: #fff;}
    .OfficeHallContentAll .searchall .searchalls .data-ul li{font-size: 14px; color: #333; padding-left: 12px; line-height: 20px;}
    .OfficeHallContentAll .searchall .searchalls .data-ul li:hover{background: #e2e2e2;}

    .searchList span em{color: #2194f1;}
    .OfficeHallContentAll .searchList {
	    padding: 30px 22px 54px 22px;
    }
    
	    .OfficeHallContentAll .searchList .searchLists .searchLists-content {
	     width: auto; 
	}
</style>
<?php
$keyWords = \Yii::$app->request->get('keyWords','');
?>
	<body>
	<div class="OfficeHallContentAll container1200 clearfix">
		<!-- 查询检索开始!!!!!!!!!!!! -->
		<div class="searchall">
			<div class="perfect-logo ">
				<span class="pull-left">办公大厅 </span>
				<span class="pull-left"> &nbsp&nbsp> 查询检索</span>
			</div>
			<div class="searchalls  clearfix"  id="search-all">
                <?php
                    switch ($postion){
                        case 1:
                            $placeholder = "请输入您要查找的关键词：资产包标题,项目标题";
                            break;
                        case 2:
                            $placeholder = "请输入您要查找的关键词：资产包标题";
                            break;
                        case 3:
                            $placeholder = "请输入您要查找的关键词：项目标题";
                            break;
                        default:
                            $placeholder = "请输入您要查找的关键词：资产包标题,项目标题";
                            break;
                    }
                ?>
				<input type="text" name="" class="pull-left" id="keywordpackage" value="<?= Yii::$app->request->get('keyWords','')?>" placeholder="<?= $placeholder?>">
				<img src="/image/officeHall/searchs.png" id="imgSearch" class="pull-right">
                <ul  class='data-ul' style='display: none;'>
                </ul>
			</div>
		</div>
		<!-- 查询检索结束!!!!!!!!!!!! -->

		<!-- 全部选项 -->
		<div class="options container1200 clearfix options1" style="display:<?= $postion != 1 ? 'none':''; ?>">
			<div class="options-nav clearfix">
                <a href="<?= '/search-all/?postion=1&keyWords='.$keyWords;?>"><span class="<?= $postion == 1?'active':''?> pull-left nav-all-1">全部</span></a>
                <a href="<?= '/search-all/?postion=2&keyWords='.$keyWords;?>"><span class="<?= $postion == 2?'active':''?> pull-left nav-pakage-1">资产包</span></a>
                <a href="<?= '/search-all/?postion=3&keyWords='.$keyWords;?>"><span class="<?= $postion == 3?'active':''?> pull-left nav-project-1">项目</span></a>
			</div>
		</div>

		<!-- 全部选项 -->
		<div class="options container1200 clearfix options2" style="display:<?= $postion == 1 ? 'none':''; ?>">
			<div class="options-nav clearfix">
                <a href="<?= '/search-all/?postion=1&keyWords='.$keyWords;?>"><span class="<?= $postion == 1?'active':''?> pull-left nav-all-2">全部</span></a>
                <a href="<?= '/search-all/?postion=2&keyWords='.$keyWords;?>"><span class="<?= $postion == 2?'active':''?> pull-left nav-pakage-2">资产包</span></a>
                <a href="<?= '/search-all/?postion=3&keyWords='.$keyWords;?>"><span class="<?= $postion == 3?'active':''?> pull-left nav-project-2">项目</span></a>
			</div>

			<!-- 资产包 -->
            <?php
            if ($postion == 2){
                ?>
                <div class="options-content options-content-1">
                    <?= $this->render('condtion-package',['provinceData'=>$provinceData]);?>
                </div>
            <?php
            }
            ?>

			<!-- 项目 切换页 -->
            <?php
            if ($postion == 3){
            ?>
			<div class="options-content options-content-2">
                <?= $this->render('condtion-project',['provinceData'=>$provinceData]);?>
			</div>
                <?php
            }
            ?>
		</div>
		<div class="options-tab  clearfix options-tab-on" style="display: none;">
			<span class="pull-left">展开</span>
			<img src="/image/officeHall/down.png" class="pull-left">
		</div>
		<div class="options-tab  clearfix options-tab-off" style="display: none;">
			<span class="pull-left">收起</span>
			<img src="/image/officeHall/top.png" class="pull-left">
		</div>

		<!-- 快捷入口开始!!!!!!!!!!!! -->
		<div class="searchList">
			<div class="searchListNav clearfix">
				<span class="pull-left">共找到 <em> <?= $count;?></em>条相关记录</span>
                <div class="reversed pull-right order <?= Yii::$app->request->get('order',0)==1 || Yii::$app->request->get('order',0)==2?'active':'';?>" id="timeOrder" data-val="<?= Yii::$app->request->get('order',0)==1?2:1; ?>">
                    <?= Yii::$app->request->get('order',0)==1 || Yii::$app->request->get('order',0)==0?'时间逆序':'时间升序'; ?>
                </div>
				<div class="default pull-right order <?= Yii::$app->request->get('order',0)==0?'active':'';?>" id="deOrder" data-val="0">默认排序</div>
				<span class="pull-right">排序方式：</span>
			</div>
            <!--资产包列表-->
            <?php
                if ($postion==1){
                    echo $this->render('table-all',['user'=>$user,'package_initiation'=>$packageTeam,'project_team'=>$projectTeam,'package_transfer'=>$packageTransfer,'auth_item'=>$authItem,'postion'=>$postion,'allData'=>$allRes,'count'=>$count,'tagStr'=>$tagStr,'normalStr'=>$normalStr]);
                }
                if ($postion==2){
                    echo $this->render('table-package',['dataPackage'=>$package,'user'=>$user,'package_transfer'=>$packageTransfer,'package_initiation'=>$packageTeam,'auth_item'=>$authItem,'postion'=>$postion,'tagStr'=>$tagStr,'normalStr'=>$normalStr]);
                }
                if ($postion==3){
                    echo $this->render('table-project',['dataProject'=>$project,'user'=>$user,'project_team'=>$projectTeam,'auth_item'=>$authItem,'postion'=>$postion,'tagStr'=>$tagStr,'normalStr'=>$normalStr]);
                }
            ?>
            <!--项目列表-->
			<!--//分页部分  开始!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
            <div class="pagingBox  pagingBoxNew" >
<!--                    <span class="pageTotal">-->
<!--					<span class="pageT"></span> 每页-->
<!--					<a id="list">-->
<!--					    --><?php //$pageNum = \common\helps\profiles::getPageNum();?>
<!--                        <span class="number">--><?//= empty($getPageNum)?$pageNum[0]:$getPageNum?><!--</span>-->
<!--						<ul class="pageTotalBox">-->
<!--							 --><?php
//                             foreach ($pageNum as $k => $v) {
//                                 echo "<li class='pageNum'>".$v."</li>";
//                             }
//                             ?>
<!--						</ul>-->
<!--					</a>-->
<!--					<b class="caret"> </b>行-->
<!--				</span>-->
                <div class="pageBox">
                    <?= $pageString; ?>
                </div>
                <span class="totalSize"> 共<span style="color: #337ab7;">
                        <?= $count;?>
                </span>条记录
            </div>
            <!-- 快捷入口结束!!!!!!!!!!!! -->
	</div>
        <!-- Modal -->
        <div class="modal fade" id="shenqingFW" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <?= $this->render('../my-package/fangwen');?>
        </div>
        <!-- 模态窗口  结束!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
        <script>
            $(function () {
                var postion ='<?php echo $postion?>';
            //-------------fly-------点击搜索----------------------------
            pageNumThis = '<?= Yii::$app->request->get('limit',10)?>';
            city = '<?= Yii::$app->request->get('city','')?>';
            tuandui = '';
            keyWords = '<?= Yii::$app->request->get('keyWords','')?>';
            zongjian = '';
            principal = '<?= Yii::$app->request->get('principal','')?>';
            province = '<?= Yii::$app->request->get('province',0)?>';
            zichanbaobei = '<?= Yii::$app->request->get('category','')?>';
            shangchuanren = '';
            zichanleixing = '<?= Yii::$app->request->get('packageType','')?>';
            dangqianzhuangtai = '<?= Yii::$app->request->get('packageState','')?>';
                industry = '<?= Yii::$app->request->get("industry","")?>';
                diyawu = '<?= Yii::$app->request->get("diyawu","")?>';
            is_title =  '<?= Yii::$app->request->get("is_title",1)?>';
            orderP = 0;
            //分页搜索
            $(".pageNum").click(function () {
                pageNumThis = $(this).text();
                var url = "/search-all/?keyWords="+keyWords+"&principal="+principal+'&category='+zichanbaobei+"&packageState="+dangqianzhuangtai+"&packageType="+zichanleixing+"&owner="+shangchuanren+"&teams="+tuandui+"&leader="+zongjian+"&province="+province+"&city="+city+'&limit='+pageNumThis+'&industry='+industry+'&entry=sala&postion='+postion+'&is_title='+is_title+'&diyawu='+diyawu;
                window.location.href = url;
            })
            //默认排序
                $("#timeOrder").click(function () {
                    orderP = $(this).data('val');
                    var url = "/search-all/index/?keyWords="+keyWords+"&principal="+principal+'&category='+zichanbaobei+"&packageState="+dangqianzhuangtai+"&packageType="+zichanleixing+"&owner="+shangchuanren+"&teams="+tuandui+"&leader="+zongjian+"&province="+province+"&city="+city+'&limit='+pageNumThis+'&industry='+industry+'&order='+orderP+'&entry=sala&postion='+postion+'&is_title='+is_title+'&diyawu='+diyawu;
                    window.location.href = url;
                })
            //时间排序
                $("#deOrder").click(function () {
                    orderP = $(this).data('val');
                    var url = "/search-all/index/?keyWords="+keyWords+"&principal="+principal+'&category='+zichanbaobei+"&packageState="+dangqianzhuangtai+"&packageType="+zichanleixing+"&owner="+shangchuanren+"&teams="+tuandui+"&leader="+zongjian+"&province="+province+"&city="+city+'&limit='+pageNumThis+'&industry='+industry+'&order='+orderP+'&entry=sala&postion='+postion+'&is_title='+is_title+'&diyawu='+diyawu;
                    window.location.href = url;
                })
             //点击搜索图标搜索
                $("#imgSearch").click(function () {
                    var keyWordsK = $("#keywordpackage").val();
                    keyWords = keyWordsK.replace(new RegExp(' ','gm'),',');//逗号替换成空
                    var url = "/search-all/index/?keyWords="+keyWords+"&principal="+principal+'&category='+zichanbaobei+"&packageState="+dangqianzhuangtai+"&packageType="+zichanleixing+"&owner="+shangchuanren+"&teams="+tuandui+"&leader="+zongjian+"&province="+province+"&city="+city+'&limit='+pageNumThis+'&industry='+industry+'&order='+orderP+'&entry=sala&postion='+postion+'&is_title='+is_title+'&diyawu='+diyawu;
                    window.location.href = url;
                })
                $(document).keydown(function (e) {
                    if (e.keyCode == 13) {
                        $("#imgSearch").click();
                    }
                });
            //-------------fly-------点击搜索----------------------------
                //---------------------联想数据-----------fly
                $("#keywordpackage").on("keyup",function(e){
                    $this = $(this);
                    last = e.timeStamp;
                    setTimeout(function(){
                        // console.log(e.timeStamp);
                        var $data_data = $this.val();
                        if(last-e.timeStamp===0){
                            $.ajax({
                                type:"get",
                                url:"/search-all/ajax-key-word",
                                data:{
                                    keyWords:$data_data,
                                    group:'<?php echo $postion?>',
                                },
                                success:function(data){
                                    var josnData = JSON.parse( data );
                                    if(josnData.code == 200 && josnData.data.count > 0){
                                        titleKeywords(josnData.data.res)
                                        $(".data-ul").show();
                                    }else{
                                        $("#search-all  ul li").remove();
                                        $(".data-ul").hide();
                                    }
                                },
                                onerror:function(){
                                    console.log("not ok");
                                }
                            })
                        }
                    },100)
                })
                function titleKeywords(data) {
                    $("#search-all ul li").remove();
                    $("#search-all ul").append(data);
                    $("#search-all ul").show();
                }
                //---------------------联想数据-----------fly
            })
        </script>
